package com.bt.dmdb.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import org.joda.time.DateTime;
import com.bt.dmdb.json.converter.JsonDateDeserializer;
import com.bt.dmdb.json.converter.JsonDateSerializer;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@Entity
@Table(name = "ODS_PROJECTS")
@SuppressWarnings("serial")
@JsonAutoDetect
public class Project implements java.io.Serializable {

    private long id;
    private String name;
    private Long serviceRequestId;
    private Long custId;
    private String custName;
    private String reference;
    private String description;
    private DateTime plannedStartDate;
    private DateTime plannedEndDate;
    private String status;
    private DateTime actualStartDate;
    private DateTime actualEndDate;
    private String managerRagStatus;
    private String ragStatus;
    private String targetRunRate;
    private String createdBy;
    private Set<PropSite> propSites = new HashSet<PropSite>(0);
    private Set<PropMilestone> propMilestones = new HashSet<PropMilestone>(0);
    private Set<ProjectSite> projectSites = new HashSet<ProjectSite>(0);
    private Set<DmEntity> dmEntities = new HashSet<DmEntity>(0);
    private Set<ProjectContact> projectContacts = new HashSet<ProjectContact>(0);
    private Set<Prop> props = new HashSet<Prop>(0);

    public Project() {
    }

    public Project(long id, String name) {
        this.id = id;
        this.name = name;
    }

    public Project(long id, String name, Long serviceRequestId, Long custId, String custName, String reference, String description, DateTime plannedStartDate, DateTime plannedEndDate, String status, DateTime actualStartDate, DateTime actualEndDate, String managerRagStatus, String ragStatus, String targetRunRate, String createdBy, Set<PropSite> propSites, Set<PropMilestone> propMilestones, Set<ProjectSite> projectSites, Set<DmEntity> dmEntities, Set<ProjectContact> projectContacts, Set<Prop> props) {
        this.id = id;
        this.name = name;
        this.serviceRequestId = serviceRequestId;
        this.custId = custId;
        this.custName = custName;
        this.reference = reference;
        this.description = description;
        this.plannedStartDate = plannedStartDate;
        this.plannedEndDate = plannedEndDate;
        this.status = status;
        this.actualStartDate = actualStartDate;
        this.actualEndDate = actualEndDate;
        this.managerRagStatus = managerRagStatus;
        this.ragStatus = ragStatus;
        this.targetRunRate = targetRunRate;
        this.createdBy = createdBy;
        this.propSites = propSites;
        this.propMilestones = propMilestones;
        this.projectSites = projectSites;
        this.dmEntities = dmEntities;
        this.projectContacts = projectContacts;
        this.props = props;
    }

    @Id
    @Column(name = "ID", unique = true, nullable = false, scale = 0)
    @GeneratedValue(generator = "projectIdGenerator")
    @GenericGenerator(name = "projectIdGenerator", strategy = "increment")
    public long getId() {
        return this.id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Column(name = "NAME", nullable = false)
    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "PROJECT_SERVICE_REQUEST_ID", precision = 10, scale = 0)
    public Long getServiceRequestId() {
        return this.serviceRequestId;
    }

    public void setServiceRequestId(Long serviceRequestId) {
        this.serviceRequestId = serviceRequestId;
    }

    @Column(name = "CUST_ID", precision = 10, scale = 0)
    public Long getCustId() {
        return this.custId;
    }

    public void setCustId(Long custId) {
        this.custId = custId;
    }

    @Column(name = "CUST_NAME", length = 50)
    public String getCustName() {
        return this.custName;
    }

    public void setCustName(String custName) {
        this.custName = custName;
    }

    @Column(name = "REFERENCE")
    public String getReference() {
        return this.reference;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    @Column(name = "DESCRIPTION", length = 2000)
    public String getDescription() {
        return this.description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Column(name = "PLANNED_START_DATE", length = 7)
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    @JsonDeserialize(using = JsonDateDeserializer.class)
    @JsonSerialize(using = JsonDateSerializer.class)
    public DateTime getPlannedStartDate() {
        return this.plannedStartDate;
    }

    public void setPlannedStartDate(DateTime plannedStartDate) {
        this.plannedStartDate = plannedStartDate;
    }

    @Column(name = "PLANNED_END_DATE", length = 7)
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    @JsonDeserialize(using = JsonDateDeserializer.class)
    @JsonSerialize(using = JsonDateSerializer.class)
    public DateTime getPlannedEndDate() {
        return this.plannedEndDate;
    }

    public void setPlannedEndDate(DateTime plannedEndDate) {
        this.plannedEndDate = plannedEndDate;
    }

    @Column(name = "PROJECT_STATUS", length = 50)
    public String getStatus() {
        return this.status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    @Column(name = "ACTUAL_START_DATE", length = 7)
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    @JsonDeserialize(using = JsonDateDeserializer.class)
    @JsonSerialize(using = JsonDateSerializer.class)
    public DateTime getActualStartDate() {
        return this.actualStartDate;
    }

    public void setActualStartDate(DateTime actualStartDate) {
        this.actualStartDate = actualStartDate;
    }

    @Column(name = "ACTUAL_END_DATE", length = 7)
    @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
    @JsonDeserialize(using = JsonDateDeserializer.class)
    @JsonSerialize(using = JsonDateSerializer.class)
    public DateTime getActualEndDate() {
        return this.actualEndDate;
    }

    public void setActualEndDate(DateTime actualEndDate) {
        this.actualEndDate = actualEndDate;
    }

    @Column(name = "PROJ_MGR_RAG_STATUS", length = 50)
    public String getManagerRagStatus() {
        return this.managerRagStatus;
    }

    public void setManagerRagStatus(String managerRagStatus) {
        this.managerRagStatus = managerRagStatus;
    }

    @Column(name = "RAG_STATUS", length = 50)
    public String getRagStatus() {
        return this.ragStatus;
    }

    public void setRagStatus(String ragStatus) {
        this.ragStatus = ragStatus;
    }

    @Column(name = "TARGET_RUN_RATE", length = 50)
    public String getTargetRunRate() {
        return this.targetRunRate;
    }

    public void setTargetRunRate(String targetRunRate) {
        this.targetRunRate = targetRunRate;
    }

    @Column(name = "CREATED_BY", length = 50)
    public String getCreatedBy() {
        return this.createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<PropSite> getPropSites() {
        return this.propSites;
    }

    public void setPropSites(Set<PropSite> propSites) {
        this.propSites = propSites;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<PropMilestone> getPropMilestones() {
        return this.propMilestones;
    }

    public void setPropMilestones(Set<PropMilestone> propMilestones) {
        this.propMilestones = propMilestones;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<ProjectSite> getProjectSites() {
        return this.projectSites;
    }

    public void setProjectSites(Set<ProjectSite> projectSites) {
        this.projectSites = projectSites;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<DmEntity> getDmEntities() {
        return this.dmEntities;
    }

    public void setDmEntities(Set<DmEntity> dmEntities) {
        this.dmEntities = dmEntities;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<ProjectContact> getProjectContacts() {
        return this.projectContacts;
    }

    public void setProjectContacts(Set<ProjectContact> projectContacts) {
        this.projectContacts = projectContacts;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "project")
    public Set<Prop> getProps() {
        return this.props;
    }

    public void setProps(Set<Prop> props) {
        this.props = props;
    }
}
